Digital image processing method employing histogram peak detection

ABSTRACT

In many digital image processing methods, it is desirable to selectively apply digital image processing to identifiable structures in the image. For this purpose it is known to select gray level thresholds between structures based upon the location of corresponding peaks in the gray level histogram of the digital image. However, it is a problem to automatically detect the locations of peaks in the histogram and to select the gray level thresholds. The present invention provides a method for automatically detecting the peaks and selecting gray level thresholds for segmenting a digital image into distinguishable structures including the steps of detecting peaks in a gray level histogram of the digital image by applying smoothing and differencing operators to the gray level histogram to generate a peak detection function wherein positive to negative zero crossings of the peak detection function represent the start of a peak, and maxima following such a zero crossing represents the end of a peak.

TECHNICAL FIELD

This invention relates to the field of digital image processing, and more particularly to a method for processing a digital image to automatically detect peaks in a gray-level histogram of the digital image. A knowledge of the location of the peaks in the histogram is useful in selecting gray level thresholds for segmenting the digital image into distinguishable structures.

BACKGROUND ART

In digital image processing, and particularly in digital radiography, various image processing methods have been applied to the digital image to increase the diagnostic usefulness of the image. For example in the field of chest radiography, the goal of these image processing methods is to reproduce faithfully or to enhance the detail in both the lungs and the mediastinum in spite of their often large differences in subject contrast. However, when these image processing methods are applied to the entire digital radiographic image, the resulting enhancement in the lung field may be destructively high, potentially decreasing the detectability of small lesions. To overcome this problem, anatomical structure-selective processing of chest radiographs is desirable to prevent the detrimental effects to one structure from outweighing the improvement to another structure.

McAdams et al (see "Histogram Directed Processing of Digital Chest Images" by H.P. McAdams et al, Investigative Radiology, March 1986, Vol. 21, pp. 253-259) have discussed anatomical-structure selective image processing as applied to digital chest radiography. They used the lung field and the mediastinum histograms individually to determine a lung/mediastinum gray level threshold. The individual histograms for the lung field and the mediastinum were constructed by a trackball-driven cursor outlining technique. The gray level threshold was selected from the gray levels at which the two histograms overlap. McAdams et al. presented impressive results of anatomical structure-selective image processing guided by a lung/mediastinum gray level threshold. However, their method for determining the gray level threshold required human intervention, and therefore it was impractical for routine application. Rosenfeld and De La Torre (see "Histogram Concavity Analysis as an Aid in Threshold Selection", IEEE Transactions on Systems Man and Cybernetics, Vol. SMC-13, 1983) proposed an algorithm that used the image histogram concavity to automatically determine a gray level threshold for the images containing at most two major gray level subpopulations. Although capable of being automated, their method is very noise sensitive. Furthermore, the threshold determined by this method always lies closer to the tallest peak in the histogram which does not prove to be satisfactory for chest radiography in general.

Another problem encountered in the effort to automate the process of image segmentation is the difficulty in determining whether and where a peak in the histogram is actually located. This problem is aggravated by the presence of noise in the image, which causes the peaks to appear as clusters of spikes.

It is therefore the object of the present invention to provide an improved digital processing method for automatically detecting peaks in the histogram of a digital image and a method of selecting gray level thresholds for segmenting a digital image into distinquishable structures, that is free from the shortcomings noted above.

DISCLOSURE OF THE INVENTION

The object of the invention is achieved by a digital image processing method for automatically detecting peaks in a gray level histogram of the digital image characterized by applying smoothing and differencing operators to the gray level histogram to generate a peak detection function wherein positive to negative zero crossings in the function represent the start of a peak, and a maximum of the function following such a positive to negative zero crossing represents the end of a peak. Gray level thresholds are set at gray levels between the detected peaks.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is block diagram showing digital image processing apparatus useful for practicing the digital image processing method of the present invention;

FIG. 2 is a histogram of a typical chest radiograph;

FIG. 3 is a graph showing the cumulative distribution function of the digital image represented by the histogram in FIG. 2;

FIG. 4 is a graph illustrating the form of the smoothing and differencing operations employed in one mode of practicing the present invention;

FIG. 5 is a graph showing a peak detection function generated by a smoothing window of width 541;

FIG. 6 is a graph showing the peak detection function generated by a smoothing window of width 271;

FIG. 7 is an enlarged view of the histogram shown in FIG. 2, illustrating the locations of the detected peaks for a smoothing window of width 541 and 271 respectively;

FIG. 8 is a flow chart of a generalized peak detection method according to the present invention; and

FIG. 9 is a histogram of a digital radiographic image of human hands.

MODES OF CARRYING OUT THE INVENTION

FIG. 1 is a schematic diagram illustrating digital image processing apparatus useful for practicing the method of the present invention. The apparatus includes a scanning input portion which may comprise, for example, a drum scanner 10 for scanning transparencies such as conventional film radiographs. The drum scanner 10 includes a transparent drum 12 on which the radiograph 14 is mounted. A light source 16 is provided inside the drum to illuminate a spot on the radiograph. A photo sensor 18 receives the light signal modulated by the radiograph 14. The drum 12 spins on its axis in the direction of arrow A to form line scans, and the light source and sensor are moved relative to the radiograph in the direction of arrow B to form the scan raster.

The analog signal detected by the photosensor 18 is amplified by an amplifier 20 and is converted to a digital signal by an analog to digital converter 22. The scanning input portion of the digital image processing apparatus may also comprise a stimulable storage phosphor radiographic imaging system of the type shown in U.S. Pat. No. 3,859,257 issued to Luckey, January 1975 reissued as U.S. Pat. No. Re. 31,847, Mar. 12, 1985.

The digital radiographic signal is stored in a memory 24 and is processed by a digital image processing computer 26. The digital image processing computer 26 may comprise a general purpose digital computer, or a special purpose digital computer designed specifically for processing images. The digital image processing computer performs operations on a digital image, such as tone scale adjustment, and edge enhancement according to well known digital image processing methods. The processed digital image is converted to a video signal by signal processing electronics and video encoder 28 and is displayed on a video monitor 30.

Alternatively, the digital image is displayed by producing a film image on output scanning apparatus 32. The output scanning apparatus comprises a digital to analog converter 34 for converting the processed digital image signal to an analog signal, an amplifier 36 for amplifying the analog image signal, and a light source 38 modulated by the analog signal. Light source 38 is focused to a spot by a lens 40 onto a photosensitive medium such as photographic film 42 on a spinning drum 44. The various elements of the digital image processing apparatus communicate via a data and control bus 46.

FIG. 2 is a histogram plot compiled from a typical chest radiograph that was scanned and digitized by apparatus such as shown in FIG. 1. The digital image signal was a 12 bit 1250×1400 pixel image. As can be seen from FIG. 2, it is not readily apparent from visual observation of the histogram, which cluster of peaks in the histogram belong to the lungs, and which to the mediastinum. The plot shown in FIG. 2 is typical of a histogram from a chest radiograph and illustrates the difficulty of selecting a gray level threshold between the lungs and mediastinum.

The inventors have found, through experimentation, that a gray level threshold between the portions of the histogram representing the lung and mediastinum may be reliably selected by the method of the present invention. The method involves the steps of applying smoothing and differencing operations to the histogram to produce a peak detection function wherein a positive to negative zero crossing in the function indicates the beginning of a peak, and a maximum occurring after such a positive to negative crossing represents the end of a peak. According to one mode of practicing the invention, the peak detection function is generated by forming the cumulative distribution function F(n) of the gray levels in the image where ##EQU1## h(n) is the image histogram and n represents the gray levels in the image 0≦n≦2^(N) -1 where N is the number of bits used to represent the digital image (e.g. N=12). A plot of F(n) from the histogram of FIG. 2 is shown in FIG. 3.

Next, the cumulative distribution function F(n) is smoothed by applying a sliding window average having a width w to produce a smoothed cumulative distribution function F_(w) (n). The peak detection function r(n) is generated by subtracting the smoothed cumulative distribution function F_(w) (n) from the original cumulative distribution function F(n) as follows:

    r(n)=F(n)-F.sub.w (n)                                      (2)

The resulting function r(n) is a function having positive to negative zero crossings that correspond to the beginnings of peaks in the histogram, and maxima corresponding to the ends of the peaks in the histograms.

Alternatively, the peak detection function r(n) can be computed directly from the histogram h(n) by the following convolution

    r(n)=q.sub.w (n)*h(n)

where q_(w) (n) is a function that can be expressed as the convolution of a "smoothing" kernel s_(w) (n) and a "differencing" kernel d(n) as follows:

    q.sub.w (n)=d(n)*s.sub.w (n)                               (4)

where ##EQU2## a plot of q_(w) (n) for a window size of w=13 is shown in FIG. 4.

FIG. 5 shows the peak detection function r(n) generated from the histogram of FIG. 1 using a smoothing window w, 541 samples wide. In FIG. 5,

a_(i) --is a positive to negative zero crossing, and indicates the gray level at which the ith peak starts

b_(i) --is a maximum after the ith positive to negative zero crossing and indicates the gray level at which the ith peak ends.

The pair (a_(i), b_(i)) characterizes the ith peak detected.

FIG. 6 shows the peak detection function r(n) generated with a window size w, 271 samples wide.

In the following description of the signal processing method,

p(n)--represents the percentage of the total number of gray levels confined to the interval [o, n] (p(n)=100 F(n))

n_(T) --represents the gray level threshold between the lung and the mediastinum

d--is an empirically derived constant representing the minimum separation in gray levels between two clusters of peaks

n_(Max) --is the largest gray level present in the image.

The steps in the signal processing method for selecting the lung/mediastinum gray level threshold will now be described in pseudo-Fortran. This description is sufficient to enable a computer programmer of ordinary skill in the art to implement the method in a general purpose digital computer or a special purpose image processing computer.

    ______________________________________                                         STEP NO.                                                                       ______________________________________                                         0.      j = 1                                                                  1.1.    Compute .sup.--F.sub.w (n) with w = w.sub.j                            1.2.    Form r(n) = F(n) - .sup.--F.sub.w (n), or q.sub.w (n) * h(n)           1.3.    Histogram peak detection: To detect peaks                                      of the histogram consider the zeros and the                                    local maxima of r(n). A zero-crossing to                                       negative values indicates the start of a                                       peak, i.e., the gray level at which the                                        crossover occurs is a.sub.i. Similarly, the                                    next zero-crossing to negative values at the                                   gray level a.sub.i+1 (a.sub.i+1 >a.sub.i) indicates                            the start of the (i+1)th peak. The gray                                        level b.sub.i, a.sub.i <b.sub.i <a.sub.i+1, at which                           r(b.sub.i) = Max [r(n)],a.sub.i < n < a.sub.i+1,                               determines the end point of the peak (see                                      FIG. 5). That is, the ith peak is                                              characterized by the pair (a.sub.i, b.sub.i), and                              the (i+1)th by (a.sub.i+1, b.sub.i+1) and so on.                               When the peak detection function has a                                         negative value at n=o, it is assumed that                                      the start of the first peak a.sub.1 is at zero.                        1.4.    Terminate the search for the peaks at the                                      gray level n.sub.S. n.sub.S is determined from                                  p(n.sub.Max -1) - P.sub.S = p(n.sub.s) (5)                                    In other words, it is assumed that there                                       does not exist a prominent detectable peak                                     in the range where the upper P.sub.S percent                                   (excluding the background level at n.sub.Max)                                  of the gray levels are confined. The value                                     of the parameter P.sub.S is determined                                         empirically by studying various chest                                          histograms.                                                                    Note: If n.sub.s is reached after a                                            zero-crossing to negative values but before                                    the next zero-crossing to negative values,                                     then the end point of the last peak                                            (a.sub.K.sbsb.1, b.sub.K.sbsb.1) is taken to be n.sub.s i.e.,                  b.sub.K.sbsb.1 = n.sub.s. At this point a set of peaks A                       defined by A .sup.Δ = {(a.sub.i, b.sub.i) : i = 1,2, . . .               ,K.sub.1 }                                                                     where 0 ≦ a.sub.i ≦ 2.sup.N - 1 and 0 ≦                   b.sub.i                                                                        ≦ 2.sup.N -1, is obtained.                                      1.5.    Preprocessing: If a.sub.i+1 -b.sub.i < m, for                                  any i = 1,2, . . . ,K.sub.1 -1 then (a.sub.i, b.sub.i) and                     (a.sub.i+1, b.sub.i+1) are combined into a single                              peak to form (a.sub.i, b.sub.i+1). In this case                                the set A becomes:                                                             A = {(a.sub.i, b.sub.i) : i=1,2, . . . K.sub.2 } (K.sub.2                      ≦ K.sub.1).                                                             Parameter m is a constant that is determined                                   experimentally.                                                        1.6.    Significance test: If the percentage of the                                    gray levels confined to the peak (a.sub.i,                                     b.sub.i), i =  1,2, . . . K.sub.2 is less than a certain                       value P.sub.sig, i.e., p(b.sub.i) - p(a.sub.i) <                               P.sub.sig, then the peak is considered to be                                   insignificant and it is excluded from the                                      set A. Thus for L (L ≧0) insignificant                                  peaks A becomes:                                                                A = {(a.sub.i, b.sub.i) : i = 1,2, . . . K.sub.3 }                             where K.sub.3 = K.sub.2 - L                                                   P.sub.sig is a value that is determined                                        experimentally.                                                        1.7.    Classification: the peaks are classified                                       into clusters as follows:                                                       (a.sub.1, b.sub.1) belongs to the first cluster.                      (i)     i = 2                                                                  (ii)    IF (a.sub.i -b.sub.i-1 < d) THEN (a.sub.i, b.sub.i) and                        (a.sub.i-1, b.sub.i-1) belong to the same cluster                              ELSE (a.sub.i, b.sub.i) belongs to the next                                    cluster; a.sub.i is the starting value of the                                  next cluster,                                                                   where d is a constant determined                                               experimentally.                                                       (iii)   i = i + 1                                                              (iv)    IF(i ≦ K.sub.3) GO TO (ii)                                              STOP                                                                   1.8.    Decision: threshold selection                                          1.8a.   If the peaks are classified into two                                           clusters then the lung/mediastinum threshold                                   is set to a gray level n.sub.T which lies                                      between the end point of the first cluster                                     and the starting point of the second                                           cluster, that is                                                               n.sub.T = int [μb(1) + (1-μ)a(2)], 0 ≦ μ ≦              1, (6)                                                                         where int[.] is the nearest integer                                            truncation function, a(2) is the starting                                      point of the second cluster, and b(1) is the                                   end point of the first cluster. (Starting                                      point of a cluster is defined to be the                                        starting point of the first peak classified                                    to that cluster. Similarly, end point of a                                     cluster is defined to be the end point of                                      the last peak classified to that cluster).                             1.8b.   If the peaks are classified into more than                                     two clusters, the separation in gray levels                                    between each successive clusters is                                            computed. The pair with the largest                                            separation is selected and the threshold is                                    set to a gray level n.sub.T that lies between                                  this pair, i.e.,                                                               n.sub.T = int [μb(l) + (1-μ)a(l+1)], 0 ≦ μ                     ≦ 1, (7)                                                                where Max [a(x+1)-b(x)] = a(l+1) - b(l).                                        x=1,2, . . . ,M                                                               (M is the total number of clusters).                                   1.8c.   If only one peak is detected (K.sub.3 =1)                              IF (K.sub.3 =1) THEN                                                                   IF ([p(n.sub.max -1) - p(b.sub.1)] < P.sub.T) THEN                               IF ( (j+1) ≦ J ) THEN                                                    w = w.sub.j+1 = (w.sub.j +1)/2                                                               ! process can                                                                   be repeated                                                                   ! with a smaller                                                                window size                                                     GO TO STEP 1.1                                                                ELSE                                                                            Histogram is essentially unimodal.                                             A threshold does not exist.                                                   END IF                                                                       ELSE                                                                             Histogram is essentially unimodal but a                                        threshold can be set.                                                          n.sub.T =  b.sub.1                                                           END IF                                                                 END IF                                                                         Note: P.sub.T is an experimentally determined                                  percentage criterium. J is a user specified                                    parameter.                                                                     1.8d.   If the peaks are classified into one cluster                                   (M=1):                                                                         IF ([p(n.sub.max -1) - p(b.sub.K.sbsb.3)] > P.sub.T) THEN                      n.sub.T = b.sub.K.sbsb.3                                               ELSE                                                                                   IF ( (j+1) ≦ J) THEN                                                      w = w.sub.j+1 = 2w.sub.j -1                                                                 ! process can be                                                                repeated                                                                      ! with a larger                                                                 window size                                                      GO TO STEP 1.1                                                               ELSE                                                                             Peaks are treated as clusters and                                              decision is made according to (1.8b).                                        END IF                                                                 END IF                                                                         ______________________________________                                    

The signal processing method was applied to the digital chest radiograph having the histogram shown in FIG. 2. The parameters were set as follows:

J=2

μ=0

N=12

w=541, 271

P_(s) =10.0

m=15

P_(sig) =1.0

d=235

P_(T) =20.0

At the end of STEP 1.6 of the method the following sets of peaks were obtained. ##EQU3## The peaks are illustrated on the image histogram in FIG. 7.

The signal processing method was tested with various chest radiographs to empirically determine the initial window size w=w₁, the separation criterion d, and the percentage criterion P_(T). In almost all cases a threshold was determined without the need to modify the initial window size w=w₁.

The threshold selection method according to the present invention was applied to an assortment of digital chest radiographs to select gray level thresholds between the lungs and the mediastinum. Then various anatomical structure selective image enhancement procedures were applied to the digital chest radiographs using the selected gray level thresholds. The image enhancement procedures included anatomical selective tone scale adjustment and edge enhancement. In these tests, the gray level thresholds automatically selected by the method of the present invention were found to be appropriate and yielded diagnostically useful results.

Steps 1.7 and 1.8 of the above method exploit the a priori knowledge of the existence of at most two well-separated (at least by d in gray levels) major histogram clusters corresponding to the mediastinum and the lung field. In general, images can have any number of major structures each of which correspond to a single, or a group of histogram peaks (clusters). The thresholds separating the major structures are then set to gray levels between these peaks. For images other than chest radiographs, the above method can be generalized as follows: steps 1.1 through 1.6 are iterated twice with window sizes w=w₁ and w=w₂ (w₁ >w₂) to obtain two sets of peaks: ##EQU4## (K≧I since the sensitivity of the peak detection increases with decreasing window size (see FIG. 7)). Based on selection rules, peaks are selected from these two sets to form a final set C of the so-called `major` peaks. The thresholds are then set to gray levels between the major peaks.

The A₂ -intervals (or equivalently the A₂ -peaks), i.e., (c_(k),d_(k))'s may overlap with the A₁ -intervals (or equivalently the A₁ -peaks), i.e., (a_(i),b_(i))'s. If the relative population of the gray levels contained in the overlap exceeds a predetermined value then the overlap is said to be `significant`. Nonoverlapping peaks, or insignificantly overlapping peaks are called `independent` peaks. The overlapping and the independent peaks are determined by the overlap detection procedure described below. The set C of the major peaks is formed via the following rules:

R1. An A₁ -peak qualifies for the set C if

(i) it is an independent peak,

(ii) it is not an independent peak but total number of the significant overlaps that are `major` overlaps is less than t (if an A₂ -peak overlaps significantly with an A₁ -peak then the overlap is a major overlap if the ratio of the number of gray levels contained in the overlap to the total number of gray levels contained in the A₁ -peak exceeds the value R_(maj)) and t is a predetermined parameter.

R2. An A₂ -peak qualifies for the set C if

(i) it is an independent peak,

(ii) it is not independent and its overlap with the A₁ -peak is a major overlap and the total number of A₂ -peaks that have major overlaps with the A₁ -peak is at least t,

(iii) it is not independent and its overlap with the A₁ -peak is not a major one but there exist at least t other A₂ -peaks with major overlaps with that A₁ -peak. In this case adjacent peaks that do not have major overlaps with the A₁ -peak are combined into single peaks.

The final set C can be defined as

    C={(e.sub.m,f.sub.m):m=1,2, . . . , M},

where (e_(m),f_(m)) ε A₁ U A₂. The thresholds are then set to gray levels

    n.sub.T.sbsb.1,n.sub.T.sbsb.2, . . . , n.sub.T.sbsb.(M-1)

where

    n.sub.T.sbsb.P =int{μf.sub.l +(1-μ)e.sub.l+1 },l=1,2 . . . , (M-1)

and

    0≦μ≦1.

the overlap detection procedure that determines the overlapping and the independent peaks will now be described in pseudo-Fortran (significant overlaps will be denoted by the `→` sign).

    ______________________________________                                         2.1. i = 1                                                                     2.2. k = 1                                                                     2.3. IF (c.sub.k ≧ a.sub.i AND b.sub.i > d.sub.k)                                                  ! A.sub.2 -peak is                                                              contained                                               (c.sub.k,d.sub.k) → (a.sub.i,b.sub.i)                                                         ! in the A.sub.1 -peak                                   k = k + 1                                                                      IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                                      END IF                                                                         IF (c.sub.k ≦ a.sub.i AND d.sub.k ≧ b.sub.i)                                           ! A.sub.1 -peak is                                                              contained                                               a.sub.i = c.sub.k     ! in the A.sub.2 -peak                                   b.sub.i = d.sub.k     ! replace the                                                                   A.sub.1 -peak                                           k = k + 1             ! with the A.sub.2 -peak                                 IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                                      END IF                                                                    2.4. IF (c.sub.k ≦  a.sub.i ≦ d.sub.k) THEN                                                 ! (c.sub.k,d.sub.k) overlaps                                                    with                                                                          ! (a.sub.i,b.sub.i) from left                       P.sub.k.sup.L = [P(d.sub.k)-p(a.sub.i)]/[p(d.sub.k)-p(c.sub.k)]                                           ! left overlap                                                                  percentage                                                 IF(P.sub.k.sup.L ≧ P.sub.L)THEN                                                            ! overlap signifi-                                                              cance                                                                         ! check. P.sub.L is the                                                         left                                                                          ! overlap signifi-                                                              cance                                                                         ! measure                                                   (c.sub.k,d.sub.k) → (a.sub.i,b.sub.i)                                   k = k + 1                                                                      IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                                      ELSE                                                                           (c.sub.k,d.sub.k) is independent                                               k = k + 1                                                                      IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                                      END IF                                                                 END IF                                                                         2.5. IF (c.sub.k  ≦ b.sub.i ≦ d.sub.k) THEN                                             ! (c.sub.k,d.sub.k) overlaps with                                              ! (a.sub.i,b.sub.i) from right                          P.sub.k.sup.R = [p(b.sub.i)-p(c.sub.k)]/[p(d.sub.k)-p(c.sub.k)]                                         ! right overlap                                                                 percentage                                           IF (i < I) P.sub.k.sup.L = [p(d.sub.k)-p(a.sub.i+1)]/[p(d.sub.k)-p(c.sub.k     )]                                                                                              ! check the possibility                                                         of                                                                            ! left overlap with                                                            ! (a.sub.i+1,b.sub.i+1)                                               IF (P.sub.k.sup.R ≧ P.sub.k.sup.L ) THEN                                             ! right overlap                                                     IF (P.sub.k.sup.R ≧ P.sub.R) THEN                                                    ! overlap signifi-                                                              cance                                                                         ! check. P.sub.R is the                                                         right                                                                         ! overlap signifi-                                                              cance                                                                         ! measure                                                           (c.sub.k,d.sub.k) → (a.sub.i,b.sub.i)                                   k = k + 1                                                                      IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                                    ELSE                                                                             (c.sub.k,d.sub.k) is independent                                               k = k + 1                                                                      IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                                    END IF                                                                       ELSE           ! left overlap with                                                             (a.sub.i+1,b.sub.i+1)                                            IF (P.sub.k.sup.L ≧ P.sub.L) THEN                                                    ! overlap signifi-                                                              cance check                                                        (c.sub.k,d.sub.k) → (a.sub.i+1,b.sub.i+1)                               k = k + 1                                                                      i = i + 1                                                                      IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                                    ELSE                                                                             (c.sub.k,d.sub.k) is independent                                               k = k + 1                                                                      IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                                    END IF                                                                       END IF                                                                 END IF                                                                         2.6. IF (d.sub.k < a.sub.i) THEN                                                                     ! (c.sub.k,d.sub.k) lies to the                                                 left of                                                      (c.sub.k,d.sub.k) is independent                                                                ! (a.sub.i,b.sub.i) with no overlap                           k = k + 1                                                                      IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                                      ELSE             ! (c.sub.k,d.sub.k) lies to the                                                 right of                                                                      ! (a.sub.i,b.sub.i) with no overlap                      IF (i ≧ I) THEN                                                                           ! it lies to the right                                                          of the                                                                        ! last A.sub.1 -peak                                                 (c.sub.k,d.sub.k) is independent                                               k = k + 1                                                                      IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                              END IF                                                                         DO LL = i + 1, I      ! check for possible                                                            overlaps                                                                      ! with upcoming                                                                 A.sub.1 -peaks                                          IF (a.sub.LL ≦ d.sub.k ≦ b.sub.LL) THEN                                                ! an overlap exists                                      i = LL                                                                         GO TO 2.3                                                                      ELSE                                                                           CONTINUE                                                                       END IF                                                                         ENDDO                                                                          (c.sub.k,d.sub.k) is independent                                                                     ! no overlap                                             k = k + 1                                                                      IF (k > K) GO TO 2.7                                                           GO TO 2.3                                                                      END IF                                                                         Note:    P.sub.L and R.sub.R are the left and the right                                 overlap significance criteria respectively.                                    P.sub.L = P.sub.R = P.sub.O without loss of                                    generality. P.sub.O is determined                                              heuristically.                                                        2.7.     A.sub.1 -peaks that either do not overlap with                                 any of the A.sub.2 -peaks or overlap with                                      A.sub.2 -peaks insignificantly are independent                                 peaks.                                                                STOP                                                                           ______________________________________                                    

The window sizes w₁ and w₂ and the criteria R_(maj), and t can be determined empirically for the class of images that is of interest. The general threshold-selection technique is illustrated in FIG. 8. The general technique was applied to a radiograph of human hands having the histogram shown in FIG. 9. The parameters were set as follows:

μ=0

N=12

w₁ =541

w₂ =271

t=1

P_(S) =10.0

m=5

P_(sig) =5.0

P_(L) =P_(R) =P_(O) =90.0

R_(maj) =0.45

The following sets of peaks were obtained with w₁ =541 and w₂ =271:

    A.sub.1 ={(0,1385),(1484,2319),(2436,2902)}(w.sub.1 =541)

and

    A.sub.2 ={(509,1385),(1496,1744),(1785,2006),(2014,2303),(2428,2623),(2662,2902)}(w.sub.2 =271).

The set C of major peaks was

    C={(509,1385),(1496,2006),(2014,2303),(2428,2623),(2662,2902)}.

The corresponding thresholds n_(T).sbsb.1 =1496, n_(T).sbsb.2 =2014, n_(T).sbsb.3 =2428, and n_(T).sbsb.4 =2662 provided a satisfactory segmentation of the hands radiograph.

INDUSTRIAL APPLICABILITY AND ADVANTAGES

The present invention provides a method for automatically detecting peaks in a gray level histogram of a digital image, and for selecting the gray level threshold values between distinguishable structures in the digital image. The method is useful in the field of digital image processing, particularly in the field of digital radiography. The method has the advantages that peaks are reliably detected in the presence of noise and gray level threshold values are selected automatically without the need for human intervention, thereby simplifying the digital image processing procedure making it more practical and useful. 

We claim:
 1. In a method of processing a digital image by computer, including the steps of forming a gray-level histogram of the digital image, forming a peak detection function from the gray-level histogram, employing the peak detection function to detect peaks in the histogram, and employing the location of detected peaks to process the image, the improvement wherein said step of forming a peak detection function comprises the steps of:a. forming a cumulative distribution function from said gray-level histogram; b. smoothing said cumulative distribution function with a sliding window average of size w to produce a smoothed cumulative distribution function; and c. subtracting said smoothed cumulative distribution function from said cumulative distribution function to produce said peak detection function; and wherein said step of employing the peak detection function to locate peaks in the histogram includes the steps of:a. identifying positive to negative zero crossings of the peak detection function as the start of a detected histogram peak, and b. identifying a maximum following such a positive to negative zero crossing as the end of a detected histogram peak.
 2. In a method of processing a digital image by computer, including the steps of forming a gray-level histogram of the digital image, forming a peak detection function from the gray-level histogram, employing the peak detection function to detect peaks in the histogram, and employing the location of detected peaks to process the image, the improvement wherein said step of forming a peak detection function comprises the step of: convolving the histogram with a function q_(w) (n) of the form:

    q.sub.w (n)=d(n)*s.sub.w (n)

where ##EQU5## where w is an adjustable parameter representing the size of an averaging window, and wherein said step of employing the peak detection function to loacate peaks in the histogram includes the steps of: a. identifying positive to negative zero crossings of the peak detection function is the start of a detected histogram peak, and b. identifying a maximum following such a positive to negative zero crossing as the end of a detected histogram peak.
 3. The digital image processing method claimed in claims 1 or 2, further including the steps of:a. employing a relatively wide window size w to form a first peak detection function; b. employing a relatively narrow window size w to form a second peak detection function; and c. forming a set of detected peaks located from said first and second peak detection functions based upon the percentage of overlap between the peaks located by said first and second peak detection functions.
 4. The digital image processing method claimed in claim 3, wherein said step of forming a set of detected peaks further includes basing said selection on the number of peaks detected by said second peak detection function that overlap with peaks detected by said first peak detection function.
 5. The digital image processing method claimed in claim 1 or 2, wherein said digital image processing is of the type including the step of determining gray-level thresholds for segmenting the digital image into distinguishable structures, the gray-level thresholds being located between detected peaks in the histogram, and wherein said step of employing the peak detection function to detect peaks further includes the step of:classifying peaks into clusters of peaks based upon the gray-level separation between the end of a detected peak, and the start of the next detected peak.
 6. The digital image processing method claimed in claim 5, wherein the step of determining the gray-level thresholds is employed to determine the gray-level threshold between lung and mediastinum in a digital chest radiograph, further comprising the steps of:a. if the peaks are classified into two clusters, setting the gray-level threshold at a convex combination of the gray-level at which the first cluster ends and the gray-level at which the second cluster starts; b. if the peaks are classified into more than 2 clusters, determine the two adjacent clusters having the largest gray-level separation and set the gray-level threshold at a convex combination of the gray-level at which the first cluster ends and the gray-level at which the second cluster starts; c. if there is only one peak, and if at least P_(t) percent of the total number of gray-levels are confined between the largest gray-level (n_(max)) and the gray-level at which the peak ends, setting the threshold to the gray-level at which the peak ends; if the P_(T) percent criterion does not hold, then repeat the peak detection and classification steps with a smaller averaging window size w and repeat step (a) et seq. if at the end of a given number of repetitions there is still one peak detected and the percent criterion does not hold, then the histogram is essentially unimodal and a threshold does not exist; and d. if the peaks are classified into only one cluster, and if at least P_(T) percent of the total number of gray-levels are confined between the largest gray-level (n_(max)) and the gray-level at which the cluster ends, setting the threshold to the gray-level at which the cluster ends, if the P_(T) percent criterion does not hold, then repeat the peak detection and classification steps with a larger averaging window size w and repeat step (a) et seq. if at the end of a given number of repetitions the peaks are classified into only one cluster and the P_(T) percent criterion does not hold, then treat the peaks as clusters and use step (b) for decision. 